package com.pai4j.common.enums.community;
import com.pai4j.common.exception.BusinessException;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * @Author: 程序员七七 chat4j.com
 * @Date: 2021-9-27 0027 0:57
 * @Description: 无描述信息
 */
@Getter
public enum PayTypeEnum {

    TEST("测试"),
    REWARD_WEB("打赏网站"),
    RESOURCE_ORDER("瑞索斯资源下载"),
    AIH5_LOVE("AI+表白H5"),
    MALL_ORDER("周边商城购买"),
    RECHARGE_INTEGRAL("积分充值"),
    RECHARGE_JIANLIBOT("简历BOT会员充值"),
    RECHARGE_ITBOOK("IT电子书读书卡充值"),
    EMOAI("EMOAI"),
    SUB_STAR("星球订阅"),
    AIGOPEN_WX_APP("AI助手微信小程序"),
    RESUME_ORDER("简历购买"),
    REWARD_RGB("证件照换底色打赏"),
    MIAOMIAOYUYIN("妙喵语音"),
    REWARD_RESOURCE("打赏资源");

    private String typeDesc;

    PayTypeEnum(String typeDesc) {
        this.typeDesc = typeDesc;
    }

    /***
     * 付款类型核验
     * @param type
     */
    public static void checkType(String type) {
        for (PayTypeEnum t : PayTypeEnum.values()) {
            if (t.name().equals(type)) {
                return;
            }
        }
        throw new BusinessException("不支持的付款类型!");
    }

    public static boolean supportKickBack(String type) {
        if (StringUtils.isBlank(type)) {
            return false;
        }
        return REWARD_WEB.name().equals(type) ||
                REWARD_WEB.name().equals(type) ||
                RESOURCE_ORDER.name().equals(type) ||
                MALL_ORDER.name().equals(type) ||
                RECHARGE_INTEGRAL.name().equals(type) ||
                RECHARGE_JIANLIBOT.name().equals(type) ||
                RECHARGE_ITBOOK.name().equals(type) ||
                SUB_STAR.name().equals(type);

    }
}
